package com.forfunnet.minjian.ui;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.forfunnet.minjian.MyApplication;
import com.forfunnet.minjian.R;

import org.androidannotations.annotations.App;
import org.androidannotations.annotations.EFragment;

/**
 * A simple {@link Fragment} subclass.
 */
@EFragment(R.layout.fragment_find)
public class FindFragment extends Fragment implements View.OnClickListener {

    @App
    MyApplication mApp;

    private String showToast = null;

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState)
    {
        View view = inflater.inflate(R.layout.fragment_find,container,false);

        view.findViewById(R.id.im_fwz).setOnClickListener(this);
        view.findViewById(R.id.im_hwg).setOnClickListener(this);
        view.findViewById(R.id.im_mg).setOnClickListener(this);
        view.findViewById(R.id.im_ljr).setOnClickListener(this);
        view.findViewById(R.id.im_sgk).setOnClickListener(this);
        view.findViewById(R.id.im_ss).setOnClickListener(this);
        view.findViewById(R.id.im_sfj).setOnClickListener(this);
        view.findViewById(R.id.im_ys).setOnClickListener(this);
        view.findViewById(R.id.im_cr).setOnClickListener(this);
        view.findViewById(R.id.im_yis).setOnClickListener(this);
        view.findViewById(R.id.im_wz).setOnClickListener(this);
        view.findViewById(R.id.im_gz).setOnClickListener(this);
        view.findViewById(R.id.im_dc).setOnClickListener(this);
        view.findViewById(R.id.im_sys).setOnClickListener(this);
        view.findViewById(R.id.im_yddr).setOnClickListener(this);
        view.findViewById(R.id.im_zxs).setOnClickListener(this);

        return view;
    }


//    public FindFragment() {
//        // Required empty public constructor
//        System.out.println("FindFragment");
//        sView = (ScrollView) getActivity().getLayoutInflater().inflate(R.layout.fragment_find3,null);
//        //sView.findViewById(R.id.im_view);
//        sView.setOnClickListener(this);
//    }


//    void init() {
//        System.out.println("FindFragment init");
//
//
//    }

    @Override
    public void onClick(View v) {
        //System.out.println("click");
        switch (v.getId()){
            case R.id.im_fwz:
                showToast = getString(R.string.fwz);
                break;
            case R.id.im_hwg:
                showToast = getString(R.string.hwg);
                break;
            case R.id.im_mg:
                showToast = getString(R.string.mg);
                break;
            case R.id.im_ljr:
                showToast = getString(R.string.ljr);
                break;

            case R.id.im_sgk:
                showToast = getString(R.string.sgk);
                break;
            case R.id.im_ss:
                showToast = getString(R.string.ss);
                break;
            case R.id.im_sfj:
                showToast = getString(R.string.sfj);
                break;
            case R.id.im_ys:
                showToast = getString(R.string.ys);
                break;

            case R.id.im_cr:
                showToast = getString(R.string.cr);
                break;
            case R.id.im_yis:
                showToast = getString(R.string.yis);
                break;
            case R.id.im_wz:
                showToast = getString(R.string.wz);
                break;
            case R.id.im_gz:
                showToast = getString(R.string.gz);
                break;

            case R.id.im_dc:
                showToast = getString(R.string.dc);
                break;
            case R.id.im_sys:
                showToast = getString(R.string.sys);
                break;
            case R.id.im_yddr:
                showToast = getString(R.string.yddr);
                break;
            case R.id.im_zxs:
                showToast = getString(R.string.zxs);
                break;
        }
        doToast();
    }
    public void doToast(){
        if(null != showToast){
            Toast.makeText(getContext(),showToast,Toast.LENGTH_SHORT).show();
        }
    }
}
